﻿using Furion.CMS.Domain;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Furion.CMS.Application.Dto
{
    /// <summary>
    /// 基本登录记录数据传输对象
    /// </summary>
    public class LoginRecordDto
    {
        /// <summary>
        /// 数据id
        /// </summary>
        public virtual int Id { get; set; }
        /// <summary>
        /// 登录账号
        /// </summary>
        public virtual string Account { get; set; }
        /// <summary>
        /// 请求来源
        /// </summary>
        public string RefererUrl { get; set; }
        /// <summary>
        /// 登录请求主机地址
        /// </summary>
        public virtual string Host { get; set; }
        /// <summary>
        /// 结果
        /// </summary>
        public virtual string Result { get; set; }
        /// <summary>
        /// 错误消息
        /// </summary>
        public virtual string ErrorMessage { get; set; }
        /// <summary>
        /// 登录时间
        /// </summary>
        public virtual DateTimeOffset LoginTime { get; set; }
        /// <summary>
        /// 主机地址是否在黑名单中
        /// </summary>
        public virtual bool HasBlacklist { get; set; }

        public LoginRecordDto SetBlacklist(Blacklist blacklist)
        {
            HasBlacklist = (blacklist != null);
            return this;
        }
    }
}
